<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>任务管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			
		});
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
        	return false;
        }
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/task/">任务列表</a></li>
		<li><a href="${ctx}/task/form">任务添加</a></li>
	</ul>
	<form:form id="searchForm" modelAttribute="task" action="${ctx}/task/" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<ul class="ul-form">
			<li><label>任务类型：</label>
                <form:select path="program" class="input-medium">
                    <option value="">请选择</option>
                    <form:options items="${fns:getDictList('TASK_TYPE')}" itemLabel="label" itemValue="code" htmlEscape="false"/>
                </form:select>
			</li>
			<li><label>任务名称：</label>
				<form:input path="taskName" htmlEscape="false" class="input-medium"/>
			</li>

			<li class="btns"><input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/></li>
			<li class="clearfix"></li>
		</ul>
	</form:form>
	<sys:message content="${message}"/>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<th>任务名称</th>
				<th>任务类型</th>
                <th>任务开始时间</th>
                <th>任务结束时间</th>				
                <th>任务图片</th>
                <th>任务链接</th>                
                <th>任务美币</th>

                                				
				<th>操作</th>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${page.list}" var="task">
			<tr>
                <td>
                    ${task.taskName}
                </td>			
                <td>			

	                ${fns:getDictLabel(task.program, 'TASK_TYPE', task.program)}	
                </td>                		
				<td>
					${task.startTime}
				</td>
                <td>
                    ${task.endTime}
                </td>		

                <td><img src="${task.showImage}"  alt="未上传" style="height:30px;weight:30px" /></td>                
                <td>                 

                    <c:choose>
                        <c:when test="${task.showLink== null}">
                            <a href="${task.link}" target="_blank">预览</a>
                        </c:when>
						<c:otherwise>
                            <a href="${task.showLink}" target="_blank">预览</a>						
						</c:otherwise>
                                                            
                    </c:choose>             
              
                </td>                                		
				<td>
					${task.exp}
				</td>
				<td>
    				<a href="${ctx}/task/form?id=${task.id}">修改</a>
					<a href="${ctx}/task/delete?id=${task.id}" onclick="return confirmx('确认要删除吗？', this.href)">删除</a>
				</td>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
</body>
</html>